<template>
  <a href="https://www.baidu.com" @click="jumpToBaidu">跳转到百度 没有修饰符</a>
  <br>
  <a href="https://www.baidu.com" @click.prevent="jumpToBaidu">跳转到百度</a>
</template>

<script setup>
    const user = 'admin'
    const jumpToBaidu = () => {
        if(user === 'admin'){
        window.open('https://www.baidu.com')
        } else {
            alert('你没有权限不能进入百度')
        }
    }
</script>

<style>

</style>